userpaymentinfo_tool = {
    form_clear: function () {
        $("#userpaymentinfo-search-form").form('reset');
        $("#userpaymentinfo-search-form").form('clear');
        $("#jobs").treegrid("uncheckAll");
        $("#userpaymentinfo_grid").treegrid("uncheckAll");
    },
    init_main_view: function () {
        var username = $("input[name='userpaymentinfo-search-username']").val();
        var phone = $("input[name='userpaymentinfo-search-phone']").val();
        var accountTimeBegin = $("input[name='account-time-from']").val();
        var accountTimesEnd = $("input[name='account-time-to']").val();
        var paymentTimeBegin = $("input[name='payment-time-from']").val();
        var paymentTimeEnd = $("input[name='payment-time-to']").val();
        $("#userpaymentinfo_grid").datagrid({
            url: getRootPath() + '/userpaymentinfo/list',
            method: 'get',
            idField: "id",
            fitColumns: true,
            toolbar: '#userpaymentinfo-tool-bar',
            rownumbers: true,
            animate: true,
            singleSelect: true,
            fit: true,
            border: false,
            pagination: true,
            striped: true,
            pagePosition: "bottom",
            pageNumber: 1,
            pageSize: 15,
            pageList: [15, 30, 45, 60],
            queryParams: {
                username: username,
                phone: phone,
                accountTimeBegin: accountTimeBegin,
                accountTimesEnd: accountTimesEnd,
                paymentTimeBegin: paymentTimeBegin,
                paymentTimeEnd:paymentTimeEnd
            },
            columns: [[
                {title: "中文名", field: "username", width: 100},
                {title: "电话", field: "phone", width: 100},
                {title: "开户时间", field: "kaihutime", width: 100},
                {title: "付款金额", field: "payment", width: 65},
                {title: "付款时间", field: "paymenttime", width: 130},
                {title: "购买产品类型", field: "explain", width: 100},
            ]]

        });
    },
    clearsearch: function (){
        $("#userpaymentinfo-search-form").form('clear');
    }

};
$(document).ready(function () {
    userpaymentinfo_tool.init_main_view();

    $("#userpaymentinfo-flash-btn").click(function () {
       //
        userpaymentinfo_tool.init_main_view();
    });
    $("#userpaymentinfo-select-btn").click(function () {
        //
        userpaymentinfo_tool.init_main_view();
    });
    $("#log-clear-btn").click(function () {
        //
        userpaymentinfo_tool.clearsearch();
    });

    //初始化日期选择器
    $(function(){
        $('#account-time-from, #account-time-to, #payment-time-from,#payment-time-to').datebox();
    });
});